# @Filename:    Sample1-add
# @Author:      王佳伟
# @Time:        2025-02-28 9:25
# @Describe:    检查质数
import unittest


def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True


class TestIsPrime(unittest.TestCase):
    def test_is_prime(self):
        self.assertTrue(is_prime(2))
        self.assertTrue(is_prime(3))
        self.assertFalse(is_prime(4))
        self.assertTrue(is_prime(5))
        self.assertFalse(is_prime(9))


if __name__ == '__main__':
    unittest.main()
